<?php
/**
 * Created by PhpStorm.
 * User: asdf
 * Date: 2021/9/24
 * Time: 1:06
 */
namespace Extentions\Loger;
use core\lib\Config;
use function core\p;

class fileloger{

    public $path = "";
    public $ext = ".#log";
    function __construct()
    {
        $this->path = $path = Config::get("log","OPT");
        if(!is_dir($path["PATH"])){
            mkdir($path,777);
        };
    }

    function log($datas){
        $dir = $this->path["PATH"].Dirp.date("YMDh");
        if (!is_dir($dir)){
            mkdir($dir,777);
        }
        $file = $dir.Dirp.date("YMDhm").$this->ext;
        $dat = date("YMDhms");
        $datas = "[".$dat."]#".$datas."\n";
        file_put_contents($file,$datas,FILE_APPEND);
    }
}

